Skip to content

Claude/fix editor upload q5 qk g#24

Merged
NerdsCorp merged 2 commits into
mainfrom
claude/fix-editor-upload-Q5QkG
Dec 28, 2025
Merged

Claude/fix editor upload q5 qk g#24
NerdsCorp merged 2 commits into
mainfrom
claude/fix-editor-upload-Q5QkG

Conversation

@NerdsCorp

Copy link
Copy Markdown
Owner

No description provided.

…oad endpoints

The upload endpoints were returning HTTP 400 (ValidationProblemDetails) because
ASP.NET Core's model binding was failing when trying to bind the subfolder
parameter from form data that wasn't being sent by the client.

Root cause:
- The [FromForm] attribute expects the parameter to be in the multipart form data
- The client uploads files but doesn't include the subfolder parameter
- Even though the parameter is nullable with a default value, the binding fails

Solution:
- Changed [FromForm] to [FromQuery] for the subfolder parameter in both:
  - UploadClientFiles endpoint (api/v1/editor/updates/client)
  - UploadEditorFiles endpoint (api/v1/editor/updates/editor)
- This allows the parameter to be read from the query string
- Works correctly when the parameter is omitted (defaults to null)

This is the proper approach for optional string parameters in file upload
endpoints, as mixing form fields with multipart file uploads can cause
validation issues in ASP.NET Core.

Fixes the HTTP 400 error that was blocking all upload attempts.
Added critical attributes to both upload endpoints to properly handle
large multipart file uploads from the editor:

1. [Consumes("multipart/form-data")]
   - Explicitly declares the endpoint accepts multipart form data
   - Helps ASP.NET Core routing and model binding understand the content type
   - Improves API documentation in Swagger

2. [DisableRequestSizeLimit]
   - Removes the default 30MB request size limit
   - Allows uploading large game asset packages without size restrictions
   - Essential for editor uploads which can contain hundreds of MB of assets

3. [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue, ValueLengthLimit = int.MaxValue)]
   - Removes limits on multipart body length and individual value length
   - Prevents HTTP 400 errors from default ASP.NET Core form size limits
   - Allows batched uploads of many files at once

Also added:
- using Microsoft.AspNetCore.Http.Features; for RequestFormLimits attribute

Without these attributes, ASP.NET Core's default FormOptions would reject
requests that exceed the built-in limits, resulting in HTTP 400 Bad Request
errors before the controller method is even reached.

These changes complement the previous fix that changed [FromForm] to
[FromQuery] for the subfolder parameter.
@NerdsCorp NerdsCorp merged commit 04c49d1 into main Dec 28, 2025
1 check passed
@NerdsCorp NerdsCorp deleted the claude/fix-editor-upload-Q5QkG branch December 28, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants